<?php 
 
namespace app\common\model;

use app\common\model\BaseModel;
use app\common\traits\ModelTrait;
use app\common\utils\JsonService;
/**
* This is the model class for table "{ptf_spec}".
*
* @property int $id 规格表 
* @property int $type_id 规格类型 
* @property string $name 规格名称
* @property int $order 排序 
* @property int $search_index 是否需要检索：1是，0否 
*/
class Spec extends BaseModel{

    protected $pk = 'id';
    protected $name = 'spec';

    use ModelTrait;
    protected $autoWriteTimestamp = true;
    //protected $dateFormat = 'Y-m-d';
    //protected $createTime = 'create_time';
    //protected $updateTime = 'update_time';

    /**
    * {@inheritdoc}
    */
    public function attributeLabels()
    {
        return [
            'id' => '规格表',
            'type_id' => '规格类型',
            'name' => '规格名称',
            'order' => '排序',
            'search_index' => '是否需要检索：1是，0否',
        ];
    }


    public function getGoodsType(){
        return $this->hasOne('GoodsType','id','type_id');
    }

    public function getSpecItems(){
        return $this->hasMany('SpecItem','spec_id','id');
    }
}


?>